﻿using Newtonsoft.Json;

namespace AutomationCommand
{
    public class opcv_ocr_click : BasiCommand
    {
        [JsonProperty("fun_type")]
        public string FunType { get; set; }

        [JsonProperty("type")]
        public string Type { get; set; }

        [JsonProperty("key")]
        public string Key { get; set; }

        [JsonProperty("overtime")]
        public string Overtime { get; set; }

        [JsonProperty("option")]
        public Option Option { get; set; }

        [JsonProperty("deviation")]
        public Deviation Deviation { get; set; }

        public opcv_ocr_click()
        {
            FunType = "opcv_ocr_click";
            OtherName = "识别点击";
            Type = "0";
            Key = "";
            Overtime = "3000";
            Option = new Option
            {
                Keyboard = "",
                Mouse = "12",
                Times = "1",
                Stamp = "0"
            };
            Deviation = new Deviation
            {
                X = "0",
                Y = "0"
            };
            SuccessJump = -1;
            FailureJump = -1;
        }

        public bool Execute()
        {
            // 在这里编写识别点击命令的逻辑
            // 返回执行结果
            return true; // 假设此处始终成功
        }
    }

    public class Option
    {
        [JsonProperty("keyboard")]
        public string Keyboard { get; set; }

        [JsonProperty("mouse")]
        public string Mouse { get; set; }

        [JsonProperty("times")]
        public string Times { get; set; }

        [JsonProperty("stamp")]
        public string Stamp { get; set; }
    }
}
